<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Report/index')}">充值记录</a></li>
			<li class="active"><a>订单统计</a></li>
			<li><a href="{:U('Report/finance')}">放款统计</a></li>
			<li><a href="{:U('Report/member')}">会员统计</a></li>
			<li><a href="{:U('Report/loan_census')}">下款统计</a></li>
		</ul>
		<form class="well form-search" method="post" action="">
			类型：<select name="timer_type">
				<php>$tpl_selected=I('request.timer_type')=='1'?"selected":"";</php>
				<option {$tpl_selected} value="1">自然日</option>
				<php>$tpl_selected=I('request.timer_type')=='2'?"selected":"";</php>
				<option {$tpl_selected} value="2">自然周</option>
				<php>$tpl_selected=I('request.timer_type')=='3'?"selected":"";</php>
				<option {$tpl_selected} value="3">自然月</option>
				</select>
			时间：<input class="js-date" type="text" name="starts" style="width: 200px;" value="{:I('request.starts',date('Y-m-d',strtotime('-6days')))}" placeholder="起始时间">
			<input class="js-date" type="text" name="ends" style="width: 200px;" value="{:I('request.ends',date('Y-m-d'))}" placeholder="结束时间">
			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="">清空</a>
		</form>
		<form method="post" class="js-ajax-form">
			<table class="table table-hover table-bordered">
				<thead>
					<tr>
						<th align="center">时间</th>
						
						<th title='放款总金额:统计订单放款总金额'>放款总金额</th>
						<th title='没计算手续费10块'>放款总本金</th>
						<th title='待收总金额:统计子订单未还金额'>待收总金额</th>
						<th title='已收总金额:统计子订单已还金额'>已收总金额</th>
						<th title='待收逾期费:统计逾期的到期时间到现在的天数*日均逾期费'>待收逾期费</th>
						
						<th>已收逾期费</th>
						<th>已收续期费</th>
						<th>坏账<br/>金额</th>
						
						<th title='正在借款中的总金额'>未到期<br/>待收金额</th>
						<th title='已到期的总金额'>已到期<br/>应收金额</th>
						<th title='逾期中的总金额'>逾期<br/>应收金额</th>
						
						<th>总服务费</th>
						
						<th>放款笔数</th>
						<th>收款笔数</th>
						<th>财务专员</th>
					</tr>
				</thead>
				<tbody>
					<foreach name="list" item="vo">
					<tr>
						<td align="center">{$vo.thedate_time}</td>
						
						<td align="center">{$vo.amount}</td>
						<td>{$vo.real_amount}</td>
						<td>{$vo.wait_amount}</td>
						<td>{$vo.collect_amount}</td>
						<td>{$vo.num_amount}</td>
						
						<td>{$vo.overdue_amount}</td>
						<td>{$vo.xu_amount}</td>
						<td>{$vo.huai_amount}</td>
						
						<td>{$vo.nodue_amount}</td>
						<td>{$vo.loan_amount}</td>
						<td>{$vo.due_amount}</td>
						
						<td>{$vo.service_amount}</td>
						
						<td>{$vo.number}</td>
						<td>{$vo.num}</td>
						<td>{$vo.loan_user}</td>
						
					</tr>
					</foreach>
				</tbody>
				<tfoot>
				<tr>
					<td>合计：</td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				</tfoot>
			</table>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
		$(function () {
            var arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14];//要取哪几列的合计
            var def = 'var ';
            for(var a in arr){
				def += ('total'+arr[a]+'=0,');
			}
            def=def.substring(0,def.length-1)+';';
            eval(def);//执行定义
            $('tbody tr').each(function() {
                for(var i in arr){
                    $(this).find('td:eq('+arr[i]+')').each(function(){
                        var tmp = $(this).text();
                        if(tmp === ''){
                            tmp = 0;
						}
						eval('total'+arr[i]+'+=parseFloat(tmp);');
                    });
				}
            });
            for(var x in arr){
                $('tfoot tr:eq(0)').find('td:eq('+arr[x]+')').text(eval('total'+arr[x]));
			}
        });
	</script>
</body>
</html>